﻿/*
 *Copyright(C) 2024 by CometGamming All rights reserved.
 *Unity版本：2022.3.43f1c1 
 *作者:程一峰  
 *创建日期: 2024-10-13 
 *模块说明：状态机节点
 *版本: 0.1.0
*/

using Sirenix.OdinInspector;
using System;

namespace Warfare.FSM
{
    /// <summary>
    /// 单个节点行为
    /// </summary>
    [Serializable]
    public abstract class FSMNodeAction
    {
        /// <summary>
        /// 行为节点名称
        /// </summary>
        [LabelText("行为名"), DisplayAsString]
        public abstract string ActionName { get; }

        protected I_FSMActor m_Actor { get; private set; }

        protected I_FSMContext m_Context { get; private set; }

        /// <summary>
        /// 进入此节点
        /// </summary>
        public virtual void OnEnter(I_FSMContext context, I_FSMActor actor)
        {
            m_Context = context;
            m_Actor = actor;
        }

        /// <summary>
        /// 运行；
        /// </summary>
        public abstract E_MachineState Update(float deltaTime);

        /// <summary>
        /// 离开此节点
        /// </summary>
        public virtual void OnExit() { }
    }
}